package xzit.gcxy.xxhzx.zhh.service.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import xzit.gcxy.xxhzx.zhh.common.Pagination;
import xzit.gcxy.xxhzx.zhh.dao.BaseDao;
import xzit.gcxy.xxhzx.zhh.entity.ManagedAccountVO;
import xzit.gcxy.xxhzx.zhh.entity.TeacherInfoVO;
import xzit.gcxy.xxhzx.zhh.service.AccountService;
import xzit.gcxy.xxhzx.zhh.service.TeacherService;
import xzit.gcxy.xxhzx.zhh.util.InstituteUtil;

@Service("accountService")
public class AccountServiceImpl extends SystemServiceImpl implements AccountService {

	@Autowired
	private BaseDao baseDao;

	public Pagination<ManagedAccountVO> findPageData(DetachedCriteria condition, int page, int rows) {
		Pagination<ManagedAccountVO> pagination = new Pagination<ManagedAccountVO>(page, rows);
		
		int total = this.baseDao.getRowCountByDetachedCriteria(condition);
		pagination.setTotalCount(total);
		condition.setProjection(null);
		if (total != 0) {
			List<ManagedAccountVO> datas = baseDao.findByDetachedCriteria(condition, page, rows);
			pagination.setDatas(datas);
		}
		return pagination;
	}

}
